import { Component, Input } from '@angular/core';
import { TableWidthConfig } from 'ng-devui';

@Component({
  selector: 'app-review-form-data',
  templateUrl: './review-form-data.component.html',
  styleUrls: ['./review-form-data.component.scss']
})
export class ReviewFormDataComponent {
  @Input() data: any;
  displayTableData=[];
  tableheight = '240px';
  tableWidthConfig: TableWidthConfig[] = [];
  dataTableOptions={
    columns: []
  };
  dataLength = 0;
  rowItemProperties=[];
  constructor() {}
  ngOnInit(): void {
    this.displayTableData = this.data.tableData
    this.tableWidthConfig = this.data.tableWidthConfig
    this.dataTableOptions = this.data.dataTableOptions
    this.rowItemProperties = this.data.items
    this.dataLength = this.data.dataLength
  }
  DeleteRole($evnet:any){
    $evnet.$checked = false
    this.displayTableData = this.displayTableData.filter((item:any)=>item!==$evnet)
    this.data.dataLength = this.displayTableData.length
    this.dataLength = this.displayTableData.length
  }
  cleared(){
    this.displayTableData.map((item:any)=>item.$checked=false)
    this.displayTableData = []
    this.dataLength = 0
    this.data.dataLength = 0
  }
}
